package structures;
import pack.MyReader;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

public class TimeReal extends TypeAbstract{

//	public static int size = 4;
	public final int value; //UNIX timestamp
	public final Date date;
	
	public TimeReal(MyReader reader)
	{
		value = reader.readInt(4);
		date = new Date ();
		date.setTime((long)value*1000);
	}
	
	public String toString()
	{
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		return date == null ? "" : df.format(date);
	}
	
	public String toFullString()
	{
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		return date == null ? "" : df.format(date);
	}
}
